package tech.horgee.config;

import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import tech.horgee.executor.MyThreadPool;

import java.util.concurrent.Executor;

@Configuration
@EnableAsync
@RequiredArgsConstructor
public class AsyncConfiguration implements AsyncConfigurer {
    private final MyThreadPool myThreadPool;

    @Override
    public Executor getAsyncExecutor() {
        return myThreadPool;
    }
}
